package com.byteshake.ddoffice.model.respository

import android.util.Log
import com.byteshake.common.base.BaseData
import com.byteshake.common.base.BaseRepository
import com.byteshake.ddoffice.model.http.WanRetrofitClient
import com.byteshake.ddoffice.model.http.api.WanApi
import com.byteshake.ddoffice.model.bean.Article
import com.byteshake.ddoffice.model.bean.Banner
import com.byteshake.ddoffice.model.bean.LoginUserInfo
import com.byteshake.ddoffice.model.http.api.DDOfficeApi


class LoginRepository : BaseRepository() {

    private val service = WanRetrofitClient.getService(DDOfficeApi::class.java)
    private val TAG = "LoginRepository"

    suspend fun requestLogin(mobile: Long, arecode: Int, pwd: String): BaseData<LoginUserInfo> {
        // mobile  arecode  platform pwd
        val map = HashMap<String, Any>()
        map["mobile"] = mobile
        map["arecode"] = arecode
        map["platform"] = "android"
        map["pwd"] = pwd
        Log.e(TAG, "requestLogin: $map")
        return executeRequest { service.login(mapToBody(map)) }
//        return executeRequest { service.getBanner() }
    }


    suspend fun testBanner(): BaseData<List<Banner>> {

        Log.e(TAG, "testBanner")
        return executeRequest { service.getBanner() }
    }

}